package thread;

public class RunnableTest {
    public static void main(String[] args) {
        /*创建线程，
        传入参数:Runnable*/
        Thread th=new Thread(new MyRunnable());
        Thread th2=new Thread(new MyRunnable(),"我的");
        /*启动线程*/
        th.start();
        th2.start();
        /*主线程执行*/
        String name=Thread.currentThread().getName();
        for (int i = 0; i < 10; i++) {
            System.out.println(name+": "+i);
        }
    }
}